import { reactive, ref } from 'vue'
import { reqAddFlowAppBody } from '@/pages/member/api/types/flowapp'
import { FormItemType } from '@/components/form/type'

export const useflowappHook = () => {
  const formData = ref<reqAddFlowAppBody>({
    flowType: 1,
    buildNo: '',
    flowName: '',
    flowNameEn: '',
    flowDescription: '',
    flowImage: '',
    flowVideoUrl: '',
    images: '',
  })
  const formItem = reactive<FormItemType[]>([
    {
      type: 'input',
      label: '流程名称',
      prop: 'flowName',
      required: true,
    },
    {
      type: 'input',
      label: '流程英文名',
      prop: 'flowNameEn',
      required: true,
    },
    {
      type: 'input',
      label: '版本号',
      prop: 'buildNo',
      required: true,
    },
    {
      type: 'radioBtn',
      label: '流程类型',
      prop: 'flowType',
      required: true,
      options: [
        { label: 'CPU', value: 1 },
        { label: 'GPU', value: 2 },
      ],
    },
    {
      type: 'textarea',
      label: '应用说明',
      prop: 'flowDescription',
      required: true,
    },
    {
      type: 'slot',
      label: '展示图片',
      slotName: 'uploadImg',
      prop: 'flowImage',
    },
    {
      type: 'slot',
      label: '展示视频',
      slotName: 'uploadVideo',
      prop: 'flowVideoUrl',
    },
  ])
  console.log(formItem, 333)
  return {
    formData,
    formItem,
  }
}
